ASPxClientStarRatingControl = _aspxCreateClass(ASPxClientControl, {
    constructor: function(name) {
        this.constructor.prototype.constructor.call(this, name);
        this.ID = name;
        this.ValueControlID = this.ID + "_Value";
        this.ValueControl = document.getElementsByName(this.ValueControlID)[0];
    },
    SetSettings: function(imageOnUrl, imageOffUrl, imageHoverUrl, maxValue, value, enabled) {
        if (value == undefined || value == null)
            value = 0;
        if (maxValue == undefined || maxValue == null)
            maxValue = 5;
        this.MaxValue = maxValue;
        this.Enabled = enabled;
        this.Value = value;
        this.ImageOn = imageOnUrl;
        this.ImageOff = imageOffUrl;
        this.ImageHover = imageHoverUrl;
        this.Images = new Array(maxValue);
        new Image().src = this.ImageOn;
        new Image().src = this.ImageOff;
        new Image().src = this.ImageHover;

        for (i = 1; i <= this.MaxValue; i++) {
            var imgID = this.ID + "_img" + i;
            var img = document.getElementById(imgID);
            if (this.Enabled) {
                img.rater = this;
                img.value = i;
                img.onclick = this.Click;
                img.onmouseover = this.Hover;
                img.onmouseout = function() { this.rater.Refresh(); };
            }
            this.Images[i] = img;
        }
    },
    SetValue: function(value) {
        this.Value = value;
        this.ValueControl.value = value;
        this.Refresh();
    },
    Refresh: function() {
        for (var i = 1; i <= this.MaxValue; i++) {
            if (this.Value >= i) {
                this.Images[i].src = this.ImageOn;
            }
            else {
                this.Images[i].src = this.ImageOff;
            }
        }
    },
    Hover: function() {
        for (var i = 1; i <= this.rater.MaxValue; i++) {
            if (this.value >= i)
                this.rater.Images[i].src = this.rater.ImageHover;
            else
                this.rater.Images[i].src = this.rater.ImageOff;
        }
    },
    Click: function() {
        this.rater.SetValue(this.value); //'this' is an image....
    }
});